package com.example.communitypro.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@ApiModel("通知类实体")
public class Notification implements Serializable {
    @ApiModelProperty(value = "主键",example="1")
    private Integer notificationId;

    @ApiModelProperty(value="产生通知的用户no",example="1")
    private Integer userNo;

    @ApiModelProperty(value = "通知类型",example="1")
    private Integer notificationType;

    @ApiModelProperty("通知日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date notificationDate;

    @ApiModelProperty(value = "与该通知有关的对象no",example="1")
    private Integer postNo;

    @ApiModelProperty(value = "是否已读",example="1")
    private Integer notificationIsRead;

    @ApiModelProperty("通知内容")
    private String notificationContext;

    @ApiModelProperty("产生通知的用户信息")
    private Object userData;

    @ApiModelProperty("产生通知从而产生影响的对象信息")
    private Object contextData;

    public Notification() {
    }

    public Notification(Integer userNo, Integer notificationType, Date notificationDate, Integer postNo, Integer notificationIsRead, String notificationContext) {
        this.userNo = userNo;
        this.notificationType = notificationType;
        this.notificationDate = notificationDate;
        this.postNo = postNo;
        this.notificationIsRead = notificationIsRead;
        this.notificationContext = notificationContext;
    }

    public Object getUserData() {
        return userData;
    }

    public void setUserData(Object userData) {
        this.userData = userData;
    }

    public Object getContextData() {
        return contextData;
    }

    public void setContextData(Object contextData) {
        this.contextData = contextData;
    }

    public String getNotificationContext() {
        return notificationContext;
    }

    public void setNotificationContext(String notificationContext) {
        this.notificationContext = notificationContext;
    }

    private static final long serialVersionUID = 1L;

    public Integer getNotificationId() {
        return notificationId;
    }

    public void setNotificationId(Integer notificationId) {
        this.notificationId = notificationId;
    }

    public Integer getUserNo() {
        return userNo;
    }

    public void setUserNo(Integer userNo) {
        this.userNo = userNo;
    }

    public Integer getNotificationType() {
        return notificationType;
    }

    public void setNotificationType(Integer notificationType) {
        this.notificationType = notificationType;
    }

    public Date getNotificationDate() {
        return notificationDate;
    }

    public void setNotificationDate(Date notificationDate) {
        this.notificationDate = notificationDate;
    }

    public Integer getPostNo() {
        return postNo;
    }

    public void setPostNo(Integer postNo) {
        this.postNo = postNo;
    }

    public Integer getNotificationIsread() {
        return notificationIsRead;
    }

    public void setNotificationIsread(Integer notificationIsRead) {
        this.notificationIsRead = notificationIsRead;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Notification other = (Notification) that;
        return (this.getNotificationId() == null ? other.getNotificationId() == null : this.getNotificationId().equals(other.getNotificationId()))
            && (this.getUserNo() == null ? other.getUserNo() == null : this.getUserNo().equals(other.getUserNo()))
            && (this.getNotificationType() == null ? other.getNotificationType() == null : this.getNotificationType().equals(other.getNotificationType()))
            && (this.getNotificationDate() == null ? other.getNotificationDate() == null : this.getNotificationDate().equals(other.getNotificationDate()))
            && (this.getPostNo() == null ? other.getPostNo() == null : this.getPostNo().equals(other.getPostNo()))
            && (this.getNotificationIsread() == null ? other.getNotificationIsread() == null : this.getNotificationIsread().equals(other.getNotificationIsread()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getNotificationId() == null) ? 0 : getNotificationId().hashCode());
        result = prime * result + ((getUserNo() == null) ? 0 : getUserNo().hashCode());
        result = prime * result + ((getNotificationType() == null) ? 0 : getNotificationType().hashCode());
        result = prime * result + ((getNotificationDate() == null) ? 0 : getNotificationDate().hashCode());
        result = prime * result + ((getPostNo() == null) ? 0 : getPostNo().hashCode());
        result = prime * result + ((getNotificationIsread() == null) ? 0 : getNotificationIsread().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", notificationId=").append(notificationId);
        sb.append(", userNo=").append(userNo);
        sb.append(", notificationType=").append(notificationType);
        sb.append(", notificationDate=").append(notificationDate);
        sb.append(", postNo=").append(postNo);
        sb.append(", notificationIsRead=").append(notificationIsRead);
        sb.append(", notificationContext=").append(notificationContext);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}